package leetcode.biweekly.week96;

//Solution4Test
public class Solution4 {
	public boolean isReachable(int targetX, int targetY) {
		if ((targetX & 1) == 0) {
			targetX /= 2;
		}
		if ((targetY & 1) == 0) {
			targetY /= 2;
		}
		if (targetX == 1 && targetY == 1) {
			return true;
		}
		if ((targetX & 1) == 1 && (targetY & 1) == 1 && targetX == targetY) {
			return false;
		}
		if ((targetX & 1) == 1 && (targetY & 1) == 1) {
			if (targetX > targetY) {
				targetX += targetY;
			} else {
				targetY += targetX;
			}
		}
		return this.isReachable(targetX, targetY);
	}

}
